// const mysql = require('mysql')
import mysql, {
    Connection,
    ConnectionConfig,
  } from 'mysql';
  
  /**
   * 初始化链接
   * @param config 数据库的配置
   */
  function init(config: ConnectionConfig): Connection {
      const connection = mysql.createConnection(config)
      connection.connect();
      return connection;
  }
  
  // connection.query('SELECT 1 + 1 AS solution', (err, rows, fields) => {
  //     if (err) throw err
  
  //     console.log('The solution is: ', rows[0].solution)
  // })
  
  // connection.end()
  
  export default {
      init
  }
  